//
//  ZZButton.h
//  ZZUIButton
//
//  Created by athena on 2018/1/24.
//  Copyright © 2018年 athena. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "ZZLabel.h"

typedef enum : NSUInteger {
    ZZButtonImageLocation_Left,
    ZZButtonImageLocation_Top,
    ZZButtonImageLocation_Right,
    ZZButtonImageLocation_Bottom,
    ZZButtonImageLocation_Top_ViewAlignmentLeft,
    ZZButtonImageLocation_Top_ViewAlignmentRight,
    ZZButtonImageLocation_Bottom_ViewAlignmentLeft,
    ZZButtonImageLocation_Bottom_ViewAlignmentRight,
    ZZButtonImageLocation_BindTitleTopLeft,
    ZZButtonImageLocation_Default = ZZButtonImageLocation_Left,
} ZZButtonImageLocation;


typedef enum : NSUInteger {
    ZZButtonContentAlignment_Center,
    ZZButtonContentAlignment_Left,
    ZZButtonContentAlignment_Top,
    ZZButtonContentAlignment_Right,
    ZZButtonContentAlignment_Bottom,
    ZZButtonContentAlignment_TopLeft,
    ZZButtonContentAlignment_TopRight,
    ZZButtonContentAlignment_BottomLeft,
    ZZButtonContentAlignment_BottomRight,
    ZZButtonContentAlignment_Default = ZZButtonContentAlignment_Center,
} ZZButtonContentAlignment;


typedef struct{
    double x;
    double y;
}ZZButtonContentOffSet;

CG_INLINE ZZButtonContentOffSet
ZZButtonContentOffSetMake(double x,double y)
{
    ZZButtonContentOffSet size;
    size.x=x;
    size.y=y;
    return size;
}

@interface ZZButton : UIControl{
}
/**
 刷新按钮布局
 */
-(void)updateUIFrame;

@property (strong, nonatomic) UIImageView *imageView;
@property (strong, nonatomic) ZZLabel *titleLabel;
@property (strong, nonatomic) UIView *contentView;
@property (strong, nonatomic) UILabel *paopaoLabel;

//选中的时候是否刷新控件布局   默认 YES
@property (assign, nonatomic) BOOL isFlushFrameWhenSelcted;

/**
 默认背景颜色
 */
@property (strong, nonatomic) UIColor *defaultBackgroundColor;

/**
 选中背景颜色
 */
@property (strong, nonatomic) UIColor *selectedBackgroundColor;

/**
 默认图片
 */
@property (strong, nonatomic) UIImage *defaultImage;

/**
 选中图片
 */
@property (strong, nonatomic) UIImage *selectedImage;

@property (strong, nonatomic) NSString *title;
@property (strong, nonatomic) NSString *selectedTitle;

/**
 默认标题颜色
 */
@property (strong, nonatomic) UIColor *defaultTitleColor;

/**
 选中标题颜色
 */
@property (strong, nonatomic) UIColor *selectedTitleColor;


/**
 图片大小
 */
@property (assign, nonatomic) CGSize imageSize;

/**
 imageView 和 titleLabel 的间隔 默认 5
 */
@property (assign, nonatomic) float spacing;

/**
 content里面图片的显示位置 在左，上，右，下边
 */
@property (assign, nonatomic) ZZButtonImageLocation imageLocation;

/**
 content的对其方式
 */
@property (assign, nonatomic) ZZButtonContentAlignment contentAlignment;

/**
 content的偏移量
 */
@property (assign, nonatomic) ZZButtonContentOffSet contentOffSet;

/**
 content的图片偏移量
 */
@property (assign, nonatomic) ZZButtonContentOffSet imageOffset;

/**
 content的相对增加宽度
 */
@property (assign, nonatomic) CGSize contentMoreSize;

/**
 调用updateUIFrame->flushTitleLabelFrame titleLabel计算时的最大宽高 仅在计算titleLabel size时使用
 */
@property (assign, nonatomic) CGSize titleLabelMaxSizeWhenChanged;

@property (strong, nonatomic) NSMutableAttributedString *attributedString;

@property (strong, nonatomic) void(^layoutSubviewsBlock)(void);
@end
